import { Component } from '@angular/core';
import { Carrier } from '../carrier';

import { OnInit } from '@angular/core';
import { Router } from '@angular/router';

import { CarrierService } from '../carrier.service';

@Component({
  selector: 'carriers-list',
  templateUrl: './carrier-list.component.html'
})

export class CarrierComponent implements OnInit {
  ngOnInit() {
    this.getCarriers();
  }

  carriers: Carrier[];
  selectedCarrier: Carrier;

  onSelect(carrier: Carrier) { this.selectedCarrier = carrier; }

  constructor(
    private router: Router,
    private carrierService: CarrierService) {
  }

  getCarriers() {
    this.carrierService.getCarriers().then(carriers => this.carriers = carriers);
  }
}
